package pkg.andru.net;

import java.io.OutputStream;
import java.net.HttpURLConnection;

/**
 * when connect will callback
 * 
 * @author idiottiger
 * 
 */
public interface HttpURLConnectionCallback {

    /**
     * before http connection connect to the server
     * 
     * @param connection
     * @param method
     * @param url
     */
    public void onPreConnection(HttpURLConnection connection, HttpRequestMethod method, String url);

    /**
     * when connect ok, get the stream will callback
     * 
     * @param statusCode
     * @param connection
     */
    public void onGetStream(int statusCode, HttpURLConnection connection);

    /**
     * when write stream will callback
     * 
     * @param outStream
     */
    public void onWriteStream(OutputStream outStream);

    /**
     * when connection error occur will callback
     * 
     * @param exception
     */
    public void onError(HttpRequestException exception);
}